package com.baichuan.enums;


import com.baichuan.util.StringUtils;

/**
 * @Auther: leo
 * @Date: 2021/10/16 16:49
 * @Description: 车商账户明细类型枚举
 */
public enum DealerAmountDetailTypeEnum {
    /**
     * 充值
     */
    recharge("recharge", "充值"),
    /**
     * 支付车300维保查询
     */
    payC300MtnceReport("c300MtnceReport", "支付车300维保查询"),
    /**
     * 支付车300碰撞查询
     */
    payC300InsuranceReport("c300InsuranceReport", "支付车300碰撞查询"),
    /**
     * 车300维保查询退款
     */
    refundC300MtnceReport("refundC300MtnceReport", "车300维保查询退款"),
    /**
     * 车300碰撞查询退款
     */
    refundC300InsuranceReport("refundC300InsuranceReport", "车300碰撞查询退款"),
    /**
     * 支付查博士维保查询
     */
    payCBSMtnceReport("payCBSMtnceReport", "支付查博士维保查询"),
    /**
     * 支付查博士碰撞查询
     */
    payCBSInsuranceReport("payCBSInsuranceReport", "支付查博士碰撞查询"),
    /**
     * 查博士维保查询退款
     */
    refundCBSMtnceReport("refundCBSMtnceReport", "查博士维保查询退款"),
    /**
     * 查博士碰撞查询退款
     */
    refundCBSInsuranceReport("refundCBSInsuranceReport", "查博士碰撞查询退款"),
    /**
     * 系统赠送
     */
    sysGive("sysGive", "系统赠送"),
    /**
     * 隐私通话
     */
    callPhone("callPhone", "隐私通话"),
    /**
     * 隐私通话退费
     */
    callPhoneRefund("callPhoneRefund", "隐私通话退费")
    ;


    /**
     * 文件代码
     */
    private final String type;

    /**
     * 文件前缀
     */
    private final String typeName;


    private DealerAmountDetailTypeEnum(final String type, final String typeName) {
        this.type = type;
        this.typeName = typeName;
    }

    public String getType() {
        return type;
    }

    public String getTypeName() {
        return typeName;
    }


    public static String getNameByType(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (DealerAmountDetailTypeEnum e : DealerAmountDetailTypeEnum.values()) {
            if (type.equals(e.type)) {
                return e.typeName;
            }
        }
        return null;
    }

    public static DealerAmountDetailTypeEnum getByType(String type) {
        if (StringUtils.isEmpty(type)) {
            return null;
        }
        for (DealerAmountDetailTypeEnum e : DealerAmountDetailTypeEnum.values()) {
            if (type.equals(e.type)) {
                return e;
            }
        }
        return null;
    }
}
